#
# Contents from ad.prepend
#
#
# Makefile for GRhino
# Copyright (c) 2000-2005, 2006 Kriang Lerdsuwanakij
# email:	lerdsuwa@users.sourceforge.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

PACKAGE		= grhino
VERSION		= 0.16.1

SHELL		= /bin/sh


srcdir		= .

top_srcdir	= .
top_builddir	= .

prefix		= /usr/local
datarootdir	= ${prefix}/share
exec_prefix	= ${prefix}
bindir		= ${exec_prefix}/bin
libdir		= ${exec_prefix}/lib
includedir	= ${prefix}/include
mandir		= ${datarootdir}/man
man1dir		= $(mandir)/man1
docdir		= ${datarootdir}/doc/${PACKAGE}
etcdir		= ${prefix}/etc
datadir		= ${datarootdir}
localedir	= ${datarootdir}/locale
helpdir		= ${datarootdir}/gnome/help/grhino
omfdir		= ${datarootdir}/omf/grhino
icon_dir	= ${datarootdir}/pixmaps

pattern_dir	= ${datarootdir}/${PACKAGE}-${VERSION}/pattern
book_dir	= ${datarootdir}/${PACKAGE}-${VERSION}/book
theme_dir	= ${datarootdir}/${PACKAGE}-${VERSION}/theme

# DESTDIR used in rules below is undefined by default.
# It will be defined when building package.

CC		= gcc -std=gnu99
CXX		= g++
CPP		= gcc -std=gnu99 -E
CXXCPP		= g++ -E

CFLAGS		= -g -O2 -W -Wall
CXXFLAGS	= -g -O2 -W -Wall
CPPFLAGS	=  -mms-bitfields -DORBIT2=1 -IC:/MinGW/msys/1.0/include/libgnomeui-2.0 -IC:/MinGW/msys/1.0/include/libart-2.0 -IC:/MinGW/msys/1.0/include/gconf/2 -IC:/MinGW/msys/1.0/include/libgnome-2.0 -IC:/MinGW/msys/1.0/include/libbonoboui-2.0 -IC:/MinGW/msys/1.0/include/libgnomecanvas-2.0 -IC:/MinGW/msys/1.0/include/gtk-2.0 -IC:/MinGW/msys/1.0/include/gdk-pixbuf-2.0 -IC:/MinGW/msys/1.0/include/gnome-vfs-2.0 -IC:/MinGW/msys/1.0/lib/gnome-vfs-2.0/include -IC:/MinGW/msys/1.0/include/orbit-2.0 -IC:/MinGW/msys/1.0/include/glib-2.0 -IC:/MinGW/msys/1.0/lib/glib-2.0/include -IC:/MinGW/msys/1.0/include/libbonobo-2.0 -IC:/MinGW/msys/1.0/include/bonobo-activation-2.0 -IC:/MinGW/msys/1.0/include/libxml2 -IC:/MinGW/msys/1.0/include/pango-1.0 -IC:/MinGW/msys/1.0/include/gail-1.0 -IC:/MinGW/msys/1.0/include/freetype2 -IC:/MinGW/msys/1.0/include -IC:/MinGW/msys/1.0/include/atk-1.0 -IC:/MinGW/msys/1.0/lib/gtk-2.0/include -IC:/MinGW/msys/1.0/include/cairo -IC:/MinGW/msys/1.0/include/libpng14

CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
CXXCFLAGS	= $(CPPFLAGS) $(CXXFLAGS)

LDFLAGS		= 
LIBS		=  -lpthread -LC:/MinGW/msys/1.0/lib -lgnomeui-2 -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2 -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgconf-2 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lintl  

INSTALL		= /bin/install -c
INSTALL_PROGRAM	= ${INSTALL}
INSTALL_DATA	= ${INSTALL} -m 644


#
# Generated by autodep 1.1.4.  DO NOT modify this line.
#

adDIRS = po

adEXECS = test grhino gtp-rhino aiai gen_book gen_opening gen_pattern \
          gen_table dump_pattern

adINTFILES = $(adOBJS)

adMAKESUBDIR_TESTS = adMakeSubdir $(adTESTS)

adOBJS = test.o alphabeta.o board.o boardio.o hash.o gtstream.o iter.o \
         order.o parity.o pattern.o proginfo.o grhino.o binfile.o book.o \
         game.o gameinfo.o gevalwin.o ggamewin.o ghistwin.o gpref.o gutil.o \
         load.o opening.o rand.o randboard.o gtp-rhino.o gtp.o aiai.o \
         gen_book.o gen_opening.o gen_pattern.o gen_table.o dump_pattern.o

adOUTFILES = $(adEXECS)

adTESTS = $(adINTFILES) $(adOUTFILES)

adTESTS_MAKESUBDIR = $(adTESTS) adMakeSubdir

adBeginSubdir = test -z "$(adDIRS)" ||    \
                for d in . $(adDIRS) ; do \
                  test $$d != . && (cd $$d; $(MAKE)

adEndSubdir =                                      );   \
                done

#
# Default target
#

default-target :  grhino gtp-rhino

adMakeSubdir :
	$(adBeginSubdir) all $(adEndSubdir)

#
# Rules for all target
#

# Compiling C/C++ sources

aiai.o : Makefile $(srcdir)/aiai.cc $(srcdir)/alphabeta.h $(srcdir)/board.h \
         $(srcdir)/boardio.h config.h $(srcdir)/game.h $(srcdir)/gameinfo.h \
         $(srcdir)/gtp.h $(srcdir)/gtstream.h $(srcdir)/iter.h \
         $(srcdir)/order.h $(srcdir)/rand.h $(srcdir)/randboard.h \
         $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/aiai.cc

alphabeta.o : Makefile $(srcdir)/alphabeta.cc $(srcdir)/alphabeta.h \
              $(srcdir)/board.h $(srcdir)/boardio.h config.h $(srcdir)/hash.h \
              $(srcdir)/iter.h $(srcdir)/order.h $(srcdir)/parity.h \
              $(srcdir)/pattern.h $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/alphabeta.cc

binfile.o : Makefile $(srcdir)/binfile.cc $(srcdir)/binfile.h \
            $(srcdir)/board.h config.h $(srcdir)/gtstream.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/binfile.cc

board.o : Makefile $(srcdir)/board.cc $(srcdir)/board.h config.h \
          $(srcdir)/hash.h $(srcdir)/iter.h $(srcdir)/order.h \
          $(srcdir)/table-dat.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/board.cc

boardio.o : Makefile $(srcdir)/board.h $(srcdir)/boardio.cc \
            $(srcdir)/boardio.h config.h $(srcdir)/iter.h $(srcdir)/order.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/boardio.cc

book.o : Makefile $(srcdir)/binfile.h $(srcdir)/board.h $(srcdir)/book.cc \
         $(srcdir)/book.h config.h $(srcdir)/gtstream.h $(srcdir)/order.h \
         $(srcdir)/proginfo.h $(srcdir)/rand.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/book.cc -DBOOK_PATH=\"${book_dir}/\"

dump_pattern.o : Makefile $(srcdir)/board.h config.h \
                 $(srcdir)/dump_pattern.cc $(srcdir)/gtstream.h \
                 $(srcdir)/pattern.h $(srcdir)/proginfo.h \
                 $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/dump_pattern.cc

game.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h $(srcdir)/boardio.h \
         $(srcdir)/book.h config.h $(srcdir)/fdstream.h $(srcdir)/game.cc \
         $(srcdir)/game.h $(srcdir)/gameinfo.h $(srcdir)/hash.h \
         $(srcdir)/iter.h $(srcdir)/opening.h $(srcdir)/order.h \
         $(srcdir)/pattern.h $(srcdir)/proginfo.h $(srcdir)/rand.h \
         $(srcdir)/randboard.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/game.cc

gameinfo.o : Makefile $(srcdir)/board.h config.h $(srcdir)/game.h \
             $(srcdir)/gameinfo.cc $(srcdir)/gameinfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gameinfo.cc

gen_book.o : Makefile $(srcdir)/binfile.h $(srcdir)/board.h $(srcdir)/book.h \
             config.h $(srcdir)/gen_book.cc $(srcdir)/gtstream.h \
             $(srcdir)/hash.h $(srcdir)/log_proc.h $(srcdir)/order.h \
             $(srcdir)/proginfo.h $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gen_book.cc

gen_opening.o : Makefile $(srcdir)/board.h config.h $(srcdir)/gen_opening.cc \
                $(srcdir)/gtstream.h $(srcdir)/opening.h \
                $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gen_opening.cc

gen_pattern.o : Makefile $(srcdir)/board.h config.h $(srcdir)/gen_pattern.cc \
                $(srcdir)/gtstream.h $(srcdir)/log_proc.h $(srcdir)/order.h \
                $(srcdir)/pattern.h $(srcdir)/proginfo.h \
                $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gen_pattern.cc

gen_table.o : Makefile config.h $(srcdir)/gen_table.cc $(srcdir)/gtstream.h \
              $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gen_table.cc

gevalwin.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h config.h \
             $(srcdir)/game.h $(srcdir)/gameinfo.h $(srcdir)/gevalwin.cc \
             $(srcdir)/iter.h $(srcdir)/order.h $(srcdir)/parity.h \
             $(srcdir)/pattern.h $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gevalwin.cc

ggamewin.o : Makefile $(srcdir)/board.h config.h $(srcdir)/game.h \
             $(srcdir)/gameinfo.h $(srcdir)/ggamewin.cc $(srcdir)/ggamewin.h \
             $(srcdir)/gtstream.h $(srcdir)/gutil.h $(srcdir)/load.h \
             $(srcdir)/log_proc.h $(srcdir)/order.h $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/ggamewin.cc

ghistwin.o : Makefile $(srcdir)/board.h config.h $(srcdir)/game.h \
             $(srcdir)/gameinfo.h $(srcdir)/ghistwin.cc $(srcdir)/gtstream.h \
             $(srcdir)/gutil.h $(srcdir)/icon_black.xpm \
             $(srcdir)/icon_empty.xpm $(srcdir)/icon_white.xpm
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/ghistwin.cc

gpref.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h $(srcdir)/book.h \
          config.h $(srcdir)/game.h $(srcdir)/gameinfo.h $(srcdir)/gpref.cc \
          $(srcdir)/gpref.h $(srcdir)/gtstream.h $(srcdir)/gutil.h \
          $(srcdir)/hash.h $(srcdir)/iter.h $(srcdir)/opening.h \
          $(srcdir)/order.h $(srcdir)/parity.h $(srcdir)/pattern.h \
          $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gpref.cc \
	       -DTHEMEDIR=\"${theme_dir}/\"

grhino.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/black.xpm \
           $(srcdir)/black_last.xpm $(srcdir)/board.h $(srcdir)/book.h \
           $(srcdir)/bottom.xpm config.h $(srcdir)/empty.xpm $(srcdir)/game.h \
           $(srcdir)/gameinfo.h $(srcdir)/gevalwin.h $(srcdir)/ggamewin.h \
           $(srcdir)/ghistwin.h $(srcdir)/gpref.h $(srcdir)/grhino.cc \
           $(srcdir)/gtstream.h $(srcdir)/gutil.h $(srcdir)/hash.h \
           $(srcdir)/highlight_black.xpm $(srcdir)/highlight_empty.xpm \
           $(srcdir)/highlight_white.xpm $(srcdir)/hint_black.xpm \
           $(srcdir)/hint_white.xpm $(srcdir)/icon_black.xpm \
           $(srcdir)/icon_bw.xpm $(srcdir)/icon_empty.xpm \
           $(srcdir)/icon_new.xpm $(srcdir)/icon_white.xpm $(srcdir)/iter.h \
           $(srcdir)/left.xpm $(srcdir)/load.h $(srcdir)/log_proc.h \
           $(srcdir)/opening.h $(srcdir)/order.h $(srcdir)/parity.h \
           $(srcdir)/pattern.h $(srcdir)/proginfo.h $(srcdir)/randboard.h \
           $(srcdir)/right.xpm $(srcdir)/scripts/version $(srcdir)/top.xpm \
           $(srcdir)/white.xpm $(srcdir)/white_last.xpm
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/grhino.cc -DPREFIX=\"${prefix}/\" \
	       -DSYSCONFDIR=\"${sysconfdir}/\" -DDATADIR=\"${datadir}/\" \
	       -DLIBDIR=\"${libdir}/\" -DTHEMEDIR=\"${theme_dir}/\" \
	       -DLOCALEDIR=\"${localedir}/\" -DICONDIR=\"${icon_dir}/\"

gtp-rhino.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h \
              $(srcdir)/boardio.h $(srcdir)/book.h config.h $(srcdir)/game.h \
              $(srcdir)/gameinfo.h $(srcdir)/gtp-rhino.cc $(srcdir)/gtp.h \
              $(srcdir)/gtstream.h $(srcdir)/hash.h $(srcdir)/iter.h \
              $(srcdir)/load.h $(srcdir)/log_proc.h $(srcdir)/opening.h \
              $(srcdir)/order.h $(srcdir)/parity.h $(srcdir)/pattern.h \
              $(srcdir)/proginfo.h $(srcdir)/rand.h $(srcdir)/randboard.h \
              $(srcdir)/scripts/version
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gtp-rhino.cc -DPREFIX=\"${prefix}/\" \
	       -DSYSCONFDIR=\"${sysconfdir}/\" -DDATADIR=\"${datadir}/\" \
	       -DLIBDIR=\"${libdir}/\" -DLOCALEDIR=\"${localedir}/\"

gtp.o : Makefile $(srcdir)/board.h config.h $(srcdir)/gtp.cc $(srcdir)/gtp.h \
        $(srcdir)/gtstream.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gtp.cc

gtstream.o : Makefile config.h $(srcdir)/gtstream.cc $(srcdir)/gtstream.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gtstream.cc

gutil.o : Makefile config.h $(srcdir)/gtstream.h $(srcdir)/gutil.cc \
          $(srcdir)/gutil.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/gutil.cc

hash.o : Makefile $(srcdir)/board.h config.h $(srcdir)/hash.cc \
         $(srcdir)/hash.h $(srcdir)/iter.h $(srcdir)/order.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/hash.cc

iter.o : Makefile $(srcdir)/board.h config.h $(srcdir)/iter.cc \
         $(srcdir)/iter.h $(srcdir)/order.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/iter.cc

load.o : Makefile $(srcdir)/board.h config.h $(srcdir)/game.h \
         $(srcdir)/gameinfo.h $(srcdir)/ggamewin.h $(srcdir)/gtstream.h \
         $(srcdir)/gutil.h $(srcdir)/load.cc $(srcdir)/load.h \
         $(srcdir)/log_proc.h $(srcdir)/order.h $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/load.cc

opening.o : Makefile $(srcdir)/board.h config.h $(srcdir)/opening-dat.h \
            $(srcdir)/opening.cc $(srcdir)/opening.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/opening.cc

order.o : Makefile $(srcdir)/board.h config.h $(srcdir)/order.cc \
          $(srcdir)/order.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/order.cc

parity.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h config.h \
           $(srcdir)/iter.h $(srcdir)/order.h $(srcdir)/parity.cc \
           $(srcdir)/parity.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/parity.cc

pattern.o : Makefile $(srcdir)/board.h config.h $(srcdir)/gtstream.h \
            $(srcdir)/order.h $(srcdir)/pattern.cc $(srcdir)/pattern.h \
            $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/pattern.cc \
	       -DPATTERN_PATH=\"${pattern_dir}/\"

proginfo.o : Makefile $(srcdir)/proginfo.cc $(srcdir)/proginfo.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/proginfo.cc

rand.o : Makefile $(srcdir)/rand.cc $(srcdir)/rand.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/rand.cc

randboard.o : Makefile $(srcdir)/board.h config.h $(srcdir)/gtstream.h \
              $(srcdir)/order.h $(srcdir)/rand.h $(srcdir)/randboard.cc \
              $(srcdir)/randboard.h
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/randboard.cc

test.o : Makefile $(srcdir)/alphabeta.h $(srcdir)/board.h $(srcdir)/boardio.h \
         config.h $(srcdir)/hash.h $(srcdir)/iter.h $(srcdir)/order.h \
         $(srcdir)/scripts/version $(srcdir)/test.cc
	$(CXX) $(CXXCFLAGS) -c $(srcdir)/test.cc

# Linking test

test : Makefile test.o alphabeta.o board.o boardio.o hash.o gtstream.o iter.o \
       order.o parity.o pattern.o proginfo.o
	$(CXX) -o test $(CXXFLAGS) $(LDFLAGS) test.o alphabeta.o board.o \
	       boardio.o hash.o gtstream.o iter.o order.o parity.o pattern.o \
	       proginfo.o $(LIBS)

# Linking grhino

grhino : Makefile grhino.o alphabeta.o binfile.o board.o boardio.o book.o \
         game.o gameinfo.o gevalwin.o ggamewin.o ghistwin.o gpref.o \
         gtstream.o gutil.o hash.o iter.o load.o opening.o order.o pattern.o \
         parity.o proginfo.o rand.o randboard.o
	$(CXX) -o grhino $(CXXFLAGS) $(LDFLAGS) grhino.o alphabeta.o \
	       binfile.o board.o boardio.o book.o game.o gameinfo.o \
	       gevalwin.o ggamewin.o ghistwin.o gpref.o gtstream.o gutil.o \
	       hash.o iter.o load.o opening.o order.o pattern.o parity.o \
	       proginfo.o rand.o randboard.o $(LIBS) \
	       -mwindows

# Linking gtp-rhino

gtp-rhino : Makefile gtp-rhino.o alphabeta.o binfile.o board.o boardio.o \
            book.o game.o gameinfo.o gtp.o gtstream.o hash.o iter.o opening.o \
            order.o pattern.o parity.o proginfo.o rand.o randboard.o
	$(CXX) -o gtp-rhino $(CXXFLAGS) $(LDFLAGS) gtp-rhino.o alphabeta.o \
	       binfile.o board.o boardio.o book.o game.o gameinfo.o gtp.o \
	       gtstream.o hash.o iter.o opening.o order.o pattern.o parity.o \
	       proginfo.o rand.o randboard.o $(LIBS)

# Linking aiai

aiai : Makefile aiai.o alphabeta.o binfile.o board.o boardio.o book.o game.o \
       gameinfo.o gtp.o gtstream.o hash.o iter.o opening.o order.o pattern.o \
       parity.o proginfo.o rand.o randboard.o
	$(CXX) -o aiai $(CXXFLAGS) $(LDFLAGS) aiai.o alphabeta.o binfile.o \
	       board.o boardio.o book.o game.o gameinfo.o gtp.o gtstream.o \
	       hash.o iter.o opening.o order.o pattern.o parity.o proginfo.o \
	       rand.o randboard.o $(LIBS)

# Linking gen_book

gen_book : Makefile gen_book.o binfile.o board.o book.o gtstream.o hash.o \
           proginfo.o rand.o
	$(CXX) -o gen_book $(CXXFLAGS) $(LDFLAGS) gen_book.o binfile.o \
	       board.o book.o gtstream.o hash.o proginfo.o rand.o $(LIBS)

# Linking gen_opening

gen_opening : Makefile gen_opening.o board.o gtstream.o hash.o
	$(CXX) -o gen_opening $(CXXFLAGS) $(LDFLAGS) gen_opening.o board.o \
	       gtstream.o hash.o $(LIBS)

# Linking gen_pattern

gen_pattern : Makefile gen_pattern.o board.o gtstream.o hash.o pattern.o \
              proginfo.o
	$(CXX) -o gen_pattern $(CXXFLAGS) $(LDFLAGS) gen_pattern.o board.o \
	       gtstream.o hash.o pattern.o proginfo.o $(LIBS)

# Linking gen_table

gen_table : Makefile gen_table.o gtstream.o
	$(CXX) -o gen_table $(CXXFLAGS) $(LDFLAGS) gen_table.o gtstream.o \
	       $(LIBS)

# Linking dump_pattern

dump_pattern : Makefile dump_pattern.o board.o gtstream.o hash.o pattern.o \
               proginfo.o
	$(CXX) -o dump_pattern $(CXXFLAGS) $(LDFLAGS) dump_pattern.o board.o \
	       gtstream.o hash.o pattern.o proginfo.o $(LIBS)

#
# End of output from ad.rule.  DO NOT modify this line.
#

#
# Contents from ad.append
#
#
# Default target
#

all: grhino test gen_book gen_opening gen_pattern gen_table dump_pattern \
     gtp-rhino aiai

# Generate en_US.UTF-8, en_GB, en_GB.UTF-8 messages automatically.
# Only used for packaging GRhino upstream source.
default-po:
	if [ ! "/mingw/bin/msgfmt" = ":" ]; then	\
		cd po;				\
		$(MAKE) update-po;		\
	fi
	perl "$(srcdir)/scripts/copy-message.pl" \
		-d CHARSET utf-8 \
		-d DATE "`date "+%Y-%m-%d %H:%M%z"`" \
		-d VERSION $(VERSION) \
		-f "$(srcdir)/scripts/copy-message" < po/grhino.pot \
		| perl "$(srcdir)/scripts/utf-quotes.pl" > po/en_US.UTF-8.po
	perl "$(srcdir)/scripts/copy-message.pl" \
		-d CHARSET iso-8859-1 \
		-d DATE "`date "+%Y-%m-%d %H:%M%z"`" \
		-d VERSION $(VERSION) \
		-f "$(srcdir)/scripts/copy-message" < po/grhino.pot \
		| perl "$(srcdir)/scripts/en_GB.pl" > po/en_GB.po
	perl "$(srcdir)/scripts/copy-message.pl" \
		-d CHARSET utf-8 \
		-d DATE "`date "+%Y-%m-%d %H:%M%z"`" \
		-d VERSION $(VERSION) \
		-f "$(srcdir)/scripts/copy-message" < po/grhino.pot \
		| perl "$(srcdir)/scripts/en_GB.pl" \
		| perl "$(srcdir)/scripts/utf-quotes.pl" > po/en_GB.UTF-8.po
	if [ ! "/mingw/bin/msgfmt" = ":" ]; then	\
		cd po;				\
		$(MAKE);			\
	fi

.PHONY : clean_curdir clean distclean_curdir distclean install

# Delete object and executable files
# Do not run rm -f ... if variables are empty
clean_curdir :
	test -z "$(adINTFILES)" || rm -f $(adINTFILES)
	test -z "$(adOUTFILES)" || rm -f $(adOUTFILES)

clean : clean_curdir
	$(adBeginSubdir) $@ $(adEndSubdir)

# Also delete files generated by `configure'
# Use `clean_curdir' to avoid recursive call to all subdirectories
distclean_curdir : clean_curdir
	rm -f config.h
	rm -f config.cache config.log config.status
	rm -f Makefile

distclean : distclean_curdir
	$(adBeginSubdir) $@ $(adEndSubdir)

install_mkdir :
	if [ ! -e "$(DESTDIR)$(bindir)" ]; then		\
		mkdir -p "$(DESTDIR)$(bindir)";		\
		chmod 755 "$(DESTDIR)$(bindir)";		\
	fi
	if [ ! -e "$(DESTDIR)$(icon_dir)" ]; then		\
		mkdir -p "$(DESTDIR)$(icon_dir)";		\
		chmod 755 "$(DESTDIR)$(icon_dir)";	\
	fi
	if [ ! -e "$(DESTDIR)$(pattern_dir)" ]; then	\
		mkdir -p "$(DESTDIR)$(pattern_dir)";	\
		chmod 755 "$(DESTDIR)$(pattern_dir)";	\
	fi
	if [ ! -e "$(DESTDIR)$(book_dir)" ]; then		\
		mkdir -p "$(DESTDIR)$(book_dir)";		\
		chmod 755 "$(DESTDIR)$(book_dir)";	\
	fi
	if [ ! -e "$(DESTDIR)$(theme_dir)" ]; then	\
		mkdir -p "$(DESTDIR)$(theme_dir)";	\
		chmod 755 "$(DESTDIR)$(theme_dir)";	\
	fi
	if [ ! -e "$(DESTDIR)$(theme_dir)/small" ]; then	\
		mkdir -p "$(DESTDIR)$(theme_dir)/small";	\
		chmod 755 "$(DESTDIR)$(theme_dir)/small";	\
	fi
	if [ ! -e "$(DESTDIR)$(omfdir)" ]; then		\
		mkdir -p "$(DESTDIR)$(omfdir)";		\
		chmod 755 "$(DESTDIR)$(omfdir)";		\
	fi
	if [ ! -e "$(DESTDIR)$(helpdir)" ]; then		\
		mkdir -p "$(DESTDIR)$(helpdir)";		\
		chmod 755 "$(DESTDIR)$(helpdir)";		\
	fi
	if [ ! -e "$(DESTDIR)$(helpdir)/C" ]; then	\
		mkdir -p "$(DESTDIR)$(helpdir)/C";	\
		chmod 755 "$(DESTDIR)$(helpdir)/C";	\
	fi
	if [ ! -e "$(DESTDIR)$(helpdir)/C/figures" ]; then  \
		mkdir -p "$(DESTDIR)$(helpdir)/C/figures";  \
		chmod 755 "$(DESTDIR)$(helpdir)/C/figures"; \
	fi

# Main installation
# Only run scrollkeeper-update when not building package
install : install_mkdir
	-$(INSTALL_PROGRAM) grhino "$(DESTDIR)$(bindir)/grhino"
	-$(INSTALL_PROGRAM) gtp-rhino "$(DESTDIR)$(bindir)/gtp-rhino"
	$(INSTALL_DATA) "$(srcdir)/row1.bin" "$(DESTDIR)$(pattern_dir)/row1.bin"
	$(INSTALL_DATA) "$(srcdir)/row2.bin" "$(DESTDIR)$(pattern_dir)/row2.bin"
	$(INSTALL_DATA) "$(srcdir)/row3.bin" "$(DESTDIR)$(pattern_dir)/row3.bin"
	$(INSTALL_DATA) "$(srcdir)/row4.bin" "$(DESTDIR)$(pattern_dir)/row4.bin"
	$(INSTALL_DATA) "$(srcdir)/diag1.bin" "$(DESTDIR)$(pattern_dir)/diag1.bin"
	$(INSTALL_DATA) "$(srcdir)/diag2.bin" "$(DESTDIR)$(pattern_dir)/diag2.bin"
	$(INSTALL_DATA) "$(srcdir)/diag3.bin" "$(DESTDIR)$(pattern_dir)/diag3.bin"
	$(INSTALL_DATA) "$(srcdir)/diag4.bin" "$(DESTDIR)$(pattern_dir)/diag4.bin"
	$(INSTALL_DATA) "$(srcdir)/diag5.bin" "$(DESTDIR)$(pattern_dir)/diag5.bin"
	$(INSTALL_DATA) "$(srcdir)/corner5x2.bin" "$(DESTDIR)$(pattern_dir)/corner5x2.bin"
	$(INSTALL_DATA) "$(srcdir)/book.bin" "$(DESTDIR)$(book_dir)/book.bin"
	$(INSTALL_DATA) "$(srcdir)/help/C/legal.xml" "$(DESTDIR)$(helpdir)/C/legal.xml"
	-scrollkeeper-preinstall "$(helpdir)/C/grhino.xml" \
		"$(srcdir)/help/C/grhino-C.omf.in" "$(DESTDIR)$(omfdir)/grhino-C.omf"
	$(INSTALL_DATA) "$(srcdir)/help/C/grhino.xml" \
		"$(DESTDIR)$(helpdir)/C/grhino.xml"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/gamelist.png" \
		"$(DESTDIR)$(helpdir)/C/figures/gamelist.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/history.png" \
		"$(DESTDIR)$(helpdir)/C/figures/history.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/mainwindow.png" \
		"$(DESTDIR)$(helpdir)/C/figures/mainwindow.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/pattern.png" \
		"$(DESTDIR)$(helpdir)/C/figures/pattern.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/prefs-ai.png" \
		"$(DESTDIR)$(helpdir)/C/figures/prefs-ai.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/prefs-board.png" \
		"$(DESTDIR)$(helpdir)/C/figures/prefs-board.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/prefs-theme.png" \
		"$(DESTDIR)$(helpdir)/C/figures/prefs-theme.png"
	$(INSTALL_DATA) "$(srcdir)/help/C/figures/toolbar-edit.png" \
		"$(DESTDIR)$(helpdir)/C/figures/toolbar-edit.png"
	$(INSTALL_DATA) "$(srcdir)/grhino.png" "$(DESTDIR)$(icon_dir)/grhino.png"
	$(INSTALL_DATA) "$(srcdir)/theme/small/black.xpm" "$(DESTDIR)$(theme_dir)/small/black.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/black_last.xpm" "$(DESTDIR)$(theme_dir)/small/black_last.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/bottom.xpm" "$(DESTDIR)$(theme_dir)/small/bottom.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/empty.xpm" "$(DESTDIR)$(theme_dir)/small/empty.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/highlight_black.xpm" "$(DESTDIR)$(theme_dir)/small/highlight_black.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/highlight_empty.xpm" "$(DESTDIR)$(theme_dir)/small/highlight_empty.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/highlight_white.xpm" "$(DESTDIR)$(theme_dir)/small/highlight_white.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/hint_black.xpm" "$(DESTDIR)$(theme_dir)/small/hint_black.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/hint_white.xpm" "$(DESTDIR)$(theme_dir)/small/hint_white.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/left.xpm" "$(DESTDIR)$(theme_dir)/small/left.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/right.xpm" "$(DESTDIR)$(theme_dir)/small/right.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/top.xpm" "$(DESTDIR)$(theme_dir)/small/top.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/white.xpm" "$(DESTDIR)$(theme_dir)/small/white.xpm"
	$(INSTALL_DATA) "$(srcdir)/theme/small/white_last.xpm" "$(DESTDIR)$(theme_dir)/small/white_last.xpm"
	if [ ! "/mingw/bin/msgfmt" = ":" ]; then				 \
		cd po;							 \
		$(MAKE) prefix="$(prefix)" DESTDIR="$(DESTDIR)" install; \
	fi
	-if [ "x$(DESTDIR)" = "x" ]; then	       \
		scrollkeeper-update -q -o "$(omfdir)"; \
	fi

# Run scrollkeeper-update.
# Intended for installation script in pre-built package
post_install:
	scrollkeeper-update -q -o "$(omfdir)"

#
# Development rules
#

$(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4/cxxac.m4
	cd "$(srcdir)" && aclocal -I acinclude.m4

$(srcdir)/config.h.in: $(srcdir)/config.h.bot $(srcdir)/acconfig.h \
		       $(srcdir)/configure.in
	cd "$(srcdir)" && autoheader && touch $(srcdir)/config.h.in

$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4
	cd "$(srcdir)" && autoconf

# Note: we should detect changes in source & header files too
$(srcdir)/Makefile.in: $(srcdir)/ad.rule $(srcdir)/ad.append \
		       $(srcdir)/ad.prepend
	cd "$(srcdir)" && autodep

